/**
 * Declaration of the loader function.
 * @param {Type} filename
 */
function loadScript(filename) {
    try {
        // Set the ajax synchronous and non-cached
        $.ajaxSetup({
            cache: false,
            async: false
        });

        $.getScript(filename)
            .done(function (script, textStatus, jqxhr) {
                console.log('Load of ' + filename + ' performed: ' + jqxhr.status);
            })
            .fail(function (jqxhr, settings, exception) {
                alert('No se pudo cargar el fichero ' + filename);
            });
        
        // Reset ajax state to previous
        $.ajaxSetup({
            cache: true,
            async: true
        });
    } catch (ex) {
        alert('Hubo una excepción cargando el script ' + filename + ': ' + ex);
    }
}

//Load of the different files
loadScript('js/obj/businessfeature.js');
loadScript('js/obj/businessobject.js');
loadScript('js/obj/comautil.js');
loadScript('js/obj/user.js');
loadScript('js/coma.js');
loadScript('js/coma-admin.js');
loadScript('js/coma-extend.js');
loadScript('js/db.js');